//package com.hq.api;
//
//
//import com.hq.pojo.Custome;
//import com.hq.service.CusService;
//import com.hq.utils.MassageJson;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.Resource;
//import java.util.List;
//
//@RestController
//@RequestMapping("/cus")
//public class CusApi {
//
//    @Resource
//    CusService cusService;
//    //添加一条数据
////    @RequestMapping(value = "/inscus", method = RequestMethod.POST)
////    public MassageJsons insCus(@RequestBody Custome custome){
////        int a = 0;
////        try {
////            System.out.println("接收到了==》"+custome);
////            String name = custome.getName();
////            System.out.println(name);
////
////            String number1 = custome.getNumber();
////
////            List cuslist = cusService.cus_list_all();
////            for (int i = 0; i < cuslist.size(); i++){
////
////                System.out.println(cuslist.get(i));
////                if (number1 == cuslist.toString()){
////
////                }
////            }
////
////
////
////            if (name == null){
////                System.out.println("未传custome.name字段");
////                return new MassageJsons("201","错误","未传custome.name字段");
////
////            }
////
////            a=cusService.ins_cus(custome);
////            System.out.println("添加了==》"+custome);
////            if (a!=0){
////                return new MassageJsons("200","成功",a);
////            }
////
////        }catch (Exception e){
////            e.printStackTrace();
////        }
////        return new MassageJsons("201","错误",a);
////    }
//
//
//    //根据customerid删除信息
//    @RequestMapping(value = "/delcus", method = RequestMethod.POST)
//    public MassageJson delCus(Integer customerid){
//        int a = 0;
//        try {
//
//            a = cusService.del_cus(customerid);
//            return new MassageJson("200","成功",a);
//        }catch (Exception e){
//            e.printStackTrace();
//        }
//        return new MassageJson("201","错误");
//    }
//
//
//    //根据customerid修改信息
//    @RequestMapping(value = "/updcus", method = RequestMethod.POST)
//    public MassageJson updCus(@RequestBody Custome custome){
//        System.out.println("接收到了==》"+custome);
//        int a = 0;
//        try{
//            a = cusService.upd_cus(custome);
//            System.out.println("a::::"+a);
//
//            System.out.println("在这里调用查询所有客户数据");
//            List<Custome> custome1 =null;
//
//            custome1=cusService.cus_list_all();
//            if (a!=0){
//                return new MassageJson("200","成功",custome1);
//            }
//        }catch (Exception e){
//            e.printStackTrace();
//        }
//        return new MassageJson("201","错误");
//    }
//
//
//    @RequestMapping(value = "/selcus", method = RequestMethod.POST)
//    public MassageJson selCus(Custome custome1){
//        Custome custome = null;
//        try {
//            custome = cusService.sel_cus(custome1);
//            if (custome!=null){
//                return new MassageJson("200","成功",custome);
//            }else {
//                return new MassageJson("201","失败",custome);
//            }
//        }catch (Exception e){
//            e.printStackTrace();
//        }
//        return new MassageJson("201","失败");
//
//    }
//
//    //查询所有客户信息
//    @RequestMapping(value = "/cuslist")
//    public MassageJson cusList(){
//        List<Custome> cuslist = null;
//        try {
//            cuslist=cusService.cus_list_all();
//            System.out.println(cuslist);
//            if (cuslist!=null){
//                return new MassageJson("200","成功",cuslist);
//            }
//
//        }catch (Exception e){
//            e.printStackTrace();
//        }
//        return new MassageJson("201","错误",cuslist);
//    }
//
//}
